package OrdersSystem;

//import java.io.IOException;

import java.sql.Time;
import java.util.Calendar;
import java.util.Date;

import DBSystem.*;

public class Main {
	public static void main (String[] args) {
		DataBase testDB = new DataBase();
		DBSystemComm dbCommunicator = new DBSystemComm();
		
		try {
			Customer customer = (Customer)dbCommunicator.getUser(112); // get the Customer
			System.out.println("Customer name: "+customer.getName());
			
			//Calendar date = Calendar.getInstance();
			//date.add(Calendar.DAY_OF_MONTH, 2);
			Date date = new Date();
			
			Time time = new Time(100);
			customer.submitSingleOrder("London", date, time, 1020982648, 2, "Accepted only in good condition");
	    } catch (NullPointerException e) {
		      System.out.println("There is no such Customer");
		}	
	    
	    try {
			PnGEmployee employee = (PnGEmployee)dbCommunicator.getUser(113); // get the Employee
			System.out.println("Employee name: "+employee.getName());		
			// view history of orders
	        employee.viewHistoryTracking(employee.getUserID());
	    } catch (NullPointerException e) {
		      System.out.println("There is no such Employee");
		}	    
		System.out.println("End Program");
		
		
		dbCommunicator = new DBSystemComm();
		Order testOrder = dbCommunicator.getOrder(2);
		if(testOrder == null) {
			System.out.println("No order stored!");
		}else {
			System.out.println("Order added!");
		}
	}
}
